<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function Father (uname , age) {
      this.uname = uname;
      this.age = age
    }
    Father.prototype.sing = function() {
      console.log('我爱唱歌');
    }
    function Son (uname , age) {
      Father.call(this, uname, age);
    }
    Son.prototype.exam = function(){
      console.log('我爱洗澡');
    }
    // 将Father.prototype负值给Son.prototype
    // Son.prototype = Father.prototype
    // 将实例化对象给到Son.prototype
    Son.prototype = new Father()
    // 将Son.prototype的constructor指向Son
    Son.prototype.constructor = Son
    Son.sing()
    Son.exam()
    Father.exam()
    Father.sing()

  </script>
</body>
</html>